package com.wp.controller;

import com.wp.pojo.Comment;
import com.wp.pojo.PageResult;
import com.wp.pojo.basePojo.SysResult;
import com.wp.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comment")
@CrossOrigin
public class CommentController {
    @Autowired
    private CommentService commentService;
    /**
     * 获取评论列表
     * */
    @GetMapping("/getList")
    public SysResult getCommentList(PageResult pageResult){
        PageResult pageResults = commentService.getCommentList(pageResult);
        return SysResult.success(pageResults);
    }
    /**
     * 删除评论
     * */
    @PostMapping("/delete")
    public SysResult deleteComment(@RequestBody Comment comment){
        commentService.deleteComment(comment);
//        commentService.deleteComment(comment.getUid());
        return SysResult.success();
    }
}
